package com.gao.entities;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: suGar
 * @Date: 2022/10/12 16:31
 */
@Data
@NoArgsConstructor
public class Result {
    private int code;
    private String message;
    private Object data;

    public Result(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Result currency(int code, String message, Object data) {
        return new Result(code, message, data);
    }

    public static Result success(String message) {
        return new Result(200, message, null);
    }

    public static Result success(String message, Object data) {
        return new Result(200, message, data);
    }

    public static Result fail(String message) {
        return new Result(500, message, null);
    }

    public static Result fail(String message, Object data) {
        return new Result(500, message, data);
    }

}
